package com.xky.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xky.pojo.Borrower;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface BorrowerMapper extends BaseMapper<Borrower> {
    /**
     * 根据图书编号查询借阅记录
     * @param bookCode 图书编号
     * @return 借阅记录
     */
    @Select("SELECT * FROM borrower WHERE book_code = #{bookCode} AND return_time IS NULL")
    Borrower getBorrowerByNo(Integer bookCode);
}
